<script>
	import app from "./config/app";

	export default {
		globalData: {
			isProject:true,
			total:{},
			Partner:[],
			indDisabled:true,
			entDisabled: true,
			isBack: false,
			timeout: 5000,
			disabled: true,
			reqId: null, //pad页面传参，新增，补填 pc传参，只读功能
			invState: '1', //页面传参  1 调查 2，补充授权提交
			userId:'',
			StdOffsurPromissory2:[],
			reuseReqId:null,
			...app,
		},
		onLaunch: function(option) {
			console.log("App Launch",option);
			// if (!Element.prototype.matches) {
			
			//     Element.prototype.matches = Element.prototype.msMatchesSelector;
			
			// }

			if (option.query.invState != undefined) {
				getApp().globalData.invState = option.query.invState
			}
			if (option.query.reqId != undefined) {
				getApp().globalData.reqId = option.query.reqId
			}
			if (option.query.userId != undefined) {
				getApp().globalData.userId = option.query.userId
			}
			if (option.query.reuseReqId != undefined) {
				getApp().globalData.reuseReqId = option.query.reuseReqId
			}
			if (option.query.loanType != undefined) {
				getApp().globalData.loanType = option.query.loanType
			}
			
			function getBrowser(n) { //获取浏览器版本信息
			  var ua = navigator.userAgent.toLowerCase(),  
			      s,  
			      name = '',  
			      ver = 0;  
			  //探测浏览器
			  (s = ua.match(/msie ([\d.]+)/)) ? _set("ie", _toFixedVersion(s[1])):  
			  (s = ua.match(/firefox\/([\d.]+)/)) ? _set("firefox", _toFixedVersion(s[1])) :  
			  (s = ua.match(/chrome\/([\d.]+)/)) ? _set("chrome", _toFixedVersion(s[1])) :  
			  (s = ua.match(/opera.([\d.]+)/)) ? _set("opera", _toFixedVersion(s[1])) :  
			  (s = ua.match(/version\/([\d.]+).*safari/)) ? _set("safari", _toFixedVersion(s[1])) : 0;  
			  
			  function _toFixedVersion(ver, floatLength) {  
			    ver = ('' + ver).replace(/_/g, '.');  
			    floatLength = floatLength || 1;  
			    ver = String(ver).split('.');  
			    ver = ver[0] + '.' + (ver[1] || '0');  
			    ver = Number(ver).toFixed(floatLength);  
			    return ver;  
			  }  
			  function _set(bname, bver) {  
			    name = bname;  
			    ver = bver;  
			  }  
			  return (n == 'n' ? name : (n == 'v' ? ver : name + ver));  
			};  
			var neihe = getBrowser("n"); // 所获得的就是浏览器所用内核。
			var banben = getBrowser("v");// 所获得的就是浏览器的版本号。
			var browser = getBrowser();// 所获得的就是浏览器内核加版本号
			console.log(neihe,banben,browser)

			!(function(doc, win) {
				var docEle = doc.documentElement, //获取html元素
					event =
					"onorientationchange" in window ? "orientationchange" : "resize", //判断是屏幕旋转还是resize;
					fn = function() {
						uni.getSystemInfo({
							success: function(res) {
								console.log(res)
								if (res.model == undefined||res.model == 'PC') {
									//docEle.style.maxWidth = 1080 + 'px'
									//console.log(res)
									var width = res.windowWidth;
									
									if(Number(banben)<60){
										width && (docEle.style.fontSize = 1 * (width / 3200) + "px"); //设置html的fontSize，随着event的改变而改变。	
									}else{
										width && (docEle.style.fontSize = 10 * (width / 3200) + "px"); //设置html的fontSize，随着event的改变而改变。
									}

									
									
									
									getApp().globalData.isPad = false
									getApp().globalData.disabled = true
								} else {
									var width = res.screenWidth;
									width && (docEle.style.fontSize = 10 * (width / 2280) + "px"); //设置html的fontSize，随着event的改变而改变。
									getApp().globalData.isPad = true
									getApp().globalData.disabled = false

								}

							},
						});
					};

				win.addEventListener(event, fn, false);
				doc.addEventListener("DOMContentLoaded", fn, false);
			})(document, window);
			


		},
		onShow: function() {
			// console.log("App Show");
			//console.log(getApp().globalData)

		},
		onHide: function() {
			// console.log("App Hide");
		},
	};
</script>

<style>
	/*每个页面公共css */
	html {
		margin: 0 auto;
		background: #f7f9fc;
		font-family: PingFangSC-Medium, PingFang SC;
	}
</style>
<style lang="scss">
	@import "./scss/common.scss";
	//如果用不到标题栏，可以在App.vue重写覆盖uniapp自带的这个CSS样式，如下重写覆盖CSS：
	uni-page-head .uni-page-head-shadow-grey:after {
	  background-image: none;
	}
	@-webkit-keyframes shadow-preload {
	0% {
	background-image: none;
	}
	
	    100% {  
	        background-image: none;  
	    }  
	}  
	
	@keyframes shadow-preload {  
	    0% {  
	        background-image: none;  
	    }  
	
	    100% {  
	        background-image: none;  
	    }  
	}
</style>
